﻿@model SysIntroduce
@{
	ViewBag.Title = "介绍信";
}
<div class="ui-widget-header">
	<div style="padding: 5px 10px; font-size: 120%">
		@ViewBag.Title
	</div>
</div>
@using (Ajax.BeginForm(null, null, new AjaxOptions { UpdateTargetId = "Main" }, new { @class = "form-edit" }))
{
	<fieldset>
		<legend>
			公司信息
			<a href="#" class="save">[保存]</a>
			@if (Model.ID > 0){@Html.ActionLink("[打印]", "Print", new { id = Model.ID, auto = true }, new { @class = "print" })}
		</legend>
		<div class="ui-content">
			<div class="ui-cell ui-cell-full">
				@Html.ValidationSummary()
			</div>
			<div class="ui-cell">
				<label>公司编号</label>
				@if (Model.ID > 0) { @Html.HiddenFor(p => p.ID) }
				@Html.EditorFor(p=>p.CompanySysNo)
				<button type="button" id="btnCompany">查找</button>
			</div>
			<div id="subCompany">
				<div class="ui-cell">
					<label>公司名称</label>
					@Html.TextBoxFor(p=>p.CompanyCaption)
				</div>
				<div class="ui-cell">
					<label>公司地址</label>
					@Html.TextBoxFor(p=>p.CompanyAddress)
				</div>
				<div class="ui-cell">
					<label>联系人</label>
					@Html.TextBoxFor(p=>p.CompanyContact)
				</div>
				<div class="ui-cell">
					<label>电话</label>
					@Html.TextBoxFor(p=>p.CompanyMobile)
				</div>
				<div class="ui-cell">
					<label>招聘岗位</label>
					@Html.DropDownListFor(p=>p.CompanyEmployeeSysNo,ViewBag.CompanyEmployeeSysNo as SelectList)
				</div>
				<div class="ui-cell">
					<label>面试日期</label>
					@Html.TextBox("InterviewDate",string.Format("{0:yyyy-MM-dd}",Model.InterviewDate))
				</div>
			</div>
		</div>
	</fieldset>
	<fieldset>
		<legend>
			个人信息
			<a href="#" class="save">[保存]</a>
		</legend>
		<div class="ui-content">
			<div class="ui-cell">
				<label>用户编号</label>
				@Html.TextBoxFor(p=>p.ClientSysNo)
				<button type="button" id="btnClient">查找</button>
			</div>
			<div id="subClient">
				<div class="ui-cell">
					<label>姓名</label>
					@Html.TextBoxFor(p=>p.ClientName)
				</div>
				<div class="ui-cell">
					<label>性别</label>
					@Html.DropDownListFor(p=>p.ClientSex,ViewBag.ClientSex as SelectList)
				</div>
				<div class="ui-cell">
					<label>出生日期</label>
					@Html.TextBox("ClientBirthday", string.Format("{0:yyyy-MM-dd}", Model.ClientBirthday))
				</div>
				<div class="ui-cell">
					<label>籍贯</label>
					@Html.TextBoxFor(p=>p.ClientBirthplace)
				</div>
				<div class="ui-cell">
					<label>电话</label>
					@Html.TextBoxFor(p=>p.ClientPhone)
				</div>
				<div class="ui-cell">
					<label>学历</label>
					@Html.DropDownListFor(p=>p.ClientEducation,ViewBag.ClientEducation as SelectList)
				</div>
				<div class="ui-cell">
					<label>工种</label>
					@Html.TextBoxFor(p=>p.ClientWork)
				</div>
				<div class="ui-cell">
					<label>工龄</label>
					@Html.TextBoxFor(p=>p.ClientWorkExpress)
				</div>
			</div>
		</div>
	</fieldset>
}
<script type="text/javascript">
	setTimeout(function () {
		$("a.save").click(function () { $(this).parents("form").submit() });
		calendar("InterviewDate"),calendar("ClientBirthday");
		$("#btnCompany").click(function () {
			$.post("@Url.Action("LoadCompany")", { cid: $("#CompanySysNo").val() }, function (data) {
				$("#subCompany").html(data);
				setTimeout(function () { calendar("InterviewDate") }, 0);
			});
		});
		$("#btnClient").click(function () {
			$.post("@Url.Action("LoadClient")", { cid: $("#ClientSysNo").val() }, function (data) {
				$("#subClient").html(data);
				setTimeout(function () { calendar("ClientBirthday") }, 0);
			});
		});
	},0);
</script>